package ca.etsmtl.log121.tp3.listener;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import ca.etsmtl.log121.tp3.controller.ApplicationController;
import ca.etsmtl.log121.tp3.model.MarkerModel;

public class MarkerListener implements ActionListener {
	ApplicationController application;
	MarkerModel marker;

	public MarkerListener(MarkerModel marker, ApplicationController application) {
		this.marker = marker;
		this.application = application;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		application.renamePerspective(application.getCurrentTab(), marker.getName()); // Rename tab first

		application.getCurrentPerspectiveView().getPerspective().load(marker);
	}

}
